﻿On Error Resume Next
Set ObjService=GetObject("IIS://LocalHost/W3SVC")
For Each obj3w In objservice   
	If IsNumeric(obj3w.Name) Then       
		Set OService=GetObject("IIS://LocalHost/W3SVC/" & obj3w.Name)       
		Set VDirObj = OService.GetObject("IIsWebVirtualDir", "ROOT")      
		If Err <> 0 Then 
			WScript.Quit (1)
		end if
		WScript.Echo Chr(10) & "[" & OService.ServerComment & "]"   

        dim state 	
		state = CInt(OService.ServerState)				
		if  state = 2 then
			WScript.Echo "running"
		elseif state = 4 then
		    WScript.Echo "stoped" 
		elseif state = 6 then
		    WScript.Echo "paused" 
		end if
        
		
		For Each Binds In OService.ServerBindings
			WScript.Echo Binds          
		Next   
			WScript.Echo    VDirObj.AdsPath & "	  "  & VDirObj.Path  		 
			
		For Each ChildObject In VDirObj
			If (Err.Number = 0) Then 
				WScript.Echo ChildObject.AdsPath &  "	  "  & ChildObject.Path
			End If
        Next
		
	end if
Next